<?php

namespace app\common\lib\message;

use think\Exception;

class Message
{
	private $scene = [
		'sms','email'
	];

	public $driver = '';
	public function __construct(string $scene = 'email')
	{

		if(!in_array($scene,$this->scene)){
			throw new Exception('不存在讯息发送场景');
		}
		$this->driver = __NAMESPACE__ . '\\'.ucfirst($scene);
		if(!class_exists($this->driver)){
			throw new Exception('不存在的讯息发送场景');
		}

		$this->driver = new $this->driver('一个短网址');

	}

	public function send(string $target = '',string $scene=''){
		return $this->driver->sendVerifyCode($target,$scene);
	}


}
